﻿using MaterialDesignThemes.Wpf;
using project.B12.application.Ioc;
using project.B12.application.ViewModels.Dialogs;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Xml.Linq;

namespace project.B12.application.Views.Dialogs
{
    /// <summary>
    /// EditUserView.xaml 的交互逻辑
    /// </summary>
    public partial class ResetPasswordView : UserControl
    {
        public string DialogHostName { get; internal set; }//对话框主机名

        public ResetPasswordView(string name)
        {
            InitializeComponent();
            (this.DataContext as ResetPasswordViewModel).UserName= name;
        }

        /// <summary>
        /// 打开对话框(重置密码)
        /// </summary>
        /// <param name="taskTemplate"></param>
        /// <param name="dialogHostName"></param>
        /// <returns></returns>
        public static async Task<string> ResetPassword(string Name, string dialogHostName = "Main")
        {
            if (DialogHost.IsDialogOpen(dialogHostName))
                return null;
            var resetPasswordView = new ResetPasswordView(Name)
            {
                DialogHostName = dialogHostName,
        };
            return (string)await DialogHost.Show(resetPasswordView, dialogHostName);
        }
    }
}